.class public Lcom/nemustech/regina/ReginaThemeSelector;
.super Landroid/app/ListActivity;
.source "ReginaThemeSelector.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/nemustech/regina/ReginaThemeSelector$ThemeAdapter;
    }
.end annotation


# static fields
.field private static LOG_FLAG:Z = false

.field private static final TAG:Ljava/lang/String; = "ReginaThemeSelector"

.field private static mThemePackageMap:Ljava/util/HashMap;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/HashMap",
            "<",
            "Ljava/lang/String;",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation
.end field


# instance fields
.field private mThemeArrayList:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation
.end field


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 25
    const/4 v0, 0x0

    sput-boolean v0, Lcom/nemustech/regina/ReginaThemeSelector;->LOG_FLAG:Z

    return-void
.end method

.method public constructor <init>()V
    .locals 0

    .prologue
    .line 23
    invoke-direct {p0}, Landroid/app/ListActivity;-><init>()V

    .line 29
    return-void
.end method

.method static synthetic access$000(Lcom/nemustech/regina/ReginaThemeSelector;)Ljava/util/ArrayList;
    .locals 1
    .parameter "x0"

    .prologue
    .line 23
    iget-object v0, p0, Lcom/nemustech/regina/ReginaThemeSelector;->mThemeArrayList:Ljava/util/ArrayList;

    return-object v0
.end method

.method static synthetic access$100()Ljava/util/HashMap;
    .locals 1

    .prologue
    .line 23
    sget-object v0, Lcom/nemustech/regina/ReginaThemeSelector;->mThemePackageMap:Ljava/util/HashMap;

    return-object v0
.end method

.method private prepareThemes()V
    .locals 7

    .prologue
    .line 103
    new-instance v2, Landroid/content/Intent;

    const-string v6, "com.nemustech.regina.THEME"

    invoke-direct {v2, v6}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    .line 104
    .local v2, intent:Landroid/content/Intent;
    const-string v6, "android.intent.category.DEFAULT"

    invoke-virtual {v2, v6}, Landroid/content/Intent;->addCategory(Ljava/lang/String;)Landroid/content/Intent;

    .line 105
    invoke-virtual {p0}, Lcom/nemustech/regina/ReginaThemeSelector;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v3

    .line 106
    .local v3, pm:Landroid/content/pm/PackageManager;
    const/4 v6, 0x0

    invoke-virtual {v3, v2, v6}, Landroid/content/pm/PackageManager;->queryIntentActivities(Landroid/content/Intent;I)Ljava/util/List;

    move-result-object v4

    .line 108
    .local v4, themeInfoList:Ljava/util/List;,"Ljava/util/List<Landroid/content/pm/ResolveInfo;>;"
    const/4 v1, 0x0

    .local v1, i:I
    :goto_0
    invoke-interface {v4}, Ljava/util/List;->size()I

    move-result v6

    if-ge v1, v6, :cond_0

    .line 109
    invoke-interface {v4, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v6

    check-cast v6, Landroid/content/pm/ResolveInfo;

    iget-object v6, v6, Landroid/content/pm/ResolveInfo;->activityInfo:Landroid/content/pm/ActivityInfo;

    iget-object v6, v6, Landroid/content/pm/ActivityInfo;->packageName:Ljava/lang/String;

    invoke-virtual {v6}, Ljava/lang/String;->toString()Ljava/lang/String;

    move-result-object v0

    .line 110
    .local v0, appPackageName:Ljava/lang/String;
    invoke-interface {v4, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v6

    check-cast v6, Landroid/content/pm/ResolveInfo;

    invoke-virtual {v6, v3}, Landroid/content/pm/ResolveInfo;->loadLabel(Landroid/content/pm/PackageManager;)Ljava/lang/CharSequence;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object v5

    .line 111
    .local v5, themeName:Ljava/lang/String;
    iget-object v6, p0, Lcom/nemustech/regina/ReginaThemeSelector;->mThemeArrayList:Ljava/util/ArrayList;

    invoke-virtual {v6, v5}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 112
    sget-object v6, Lcom/nemustech/regina/ReginaThemeSelector;->mThemePackageMap:Ljava/util/HashMap;

    invoke-virtual {v6, v5, v0}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 108
    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    .line 114
    .end local v0           #appPackageName:Ljava/lang/String;
    .end local v5           #themeName:Ljava/lang/String;
    :cond_0
    return-void
.end method


# virtual methods
.method public onCreate(Landroid/os/Bundle;)V
    .locals 1
    .parameter "savedInstanceState"

    .prologue
    .line 91
    invoke-super {p0, p1}, Landroid/app/ListActivity;->onCreate(Landroid/os/Bundle;)V

    .line 93
    const v0, 0x7f030010

    invoke-virtual {p0, v0}, Lcom/nemustech/regina/ReginaThemeSelector;->setContentView(I)V

    .line 95
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lcom/nemustech/regina/ReginaThemeSelector;->mThemeArrayList:Ljava/util/ArrayList;

    .line 96
    new-instance v0, Ljava/util/HashMap;

    invoke-direct {v0}, Ljava/util/HashMap;-><init>()V

    sput-object v0, Lcom/nemustech/regina/ReginaThemeSelector;->mThemePackageMap:Ljava/util/HashMap;

    .line 98
    invoke-direct {p0}, Lcom/nemustech/regina/ReginaThemeSelector;->prepareThemes()V

    .line 99
    new-instance v0, Lcom/nemustech/regina/ReginaThemeSelector$ThemeAdapter;

    invoke-direct {v0, p0, p0}, Lcom/nemustech/regina/ReginaThemeSelector$ThemeAdapter;-><init>(Lcom/nemustech/regina/ReginaThemeSelector;Landroid/content/Context;)V

    invoke-virtual {p0, v0}, Lcom/nemustech/regina/ReginaThemeSelector;->setListAdapter(Landroid/widget/ListAdapter;)V

    .line 100
    return-void
.end method

.method protected onListItemClick(Landroid/widget/ListView;Landroid/view/View;IJ)V
    .locals 5
    .parameter "l"
    .parameter "v"
    .parameter "position"
    .parameter "id"

    .prologue
    .line 118
    iget-object v3, p0, Lcom/nemustech/regina/ReginaThemeSelector;->mThemeArrayList:Ljava/util/ArrayList;

    invoke-virtual {v3, p3}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/lang/String;

    .line 119
    .local v1, keyString:Ljava/lang/String;
    sget-object v3, Lcom/nemustech/regina/ReginaThemeSelector;->mThemePackageMap:Ljava/util/HashMap;

    invoke-virtual {v3, v1}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Ljava/lang/String;

    .line 121
    .local v2, valueString:Ljava/lang/String;
    new-instance v3, Landroid/content/Intent;

    invoke-direct {v3}, Landroid/content/Intent;-><init>()V

    const-class v4, Lcom/nemustech/regina/ReginaWallpaperSelector;

    invoke-virtual {v3, p0, v4}, Landroid/content/Intent;->setClass(Landroid/content/Context;Ljava/lang/Class;)Landroid/content/Intent;

    move-result-object v0

    .line 122
    .local v0, intent:Landroid/content/Intent;
    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 123
    const/high16 v3, 0x1000

    invoke-virtual {v0, v3}, Landroid/content/Intent;->addFlags(I)Landroid/content/Intent;

    .line 124
    invoke-virtual {p0, v0}, Lcom/nemustech/regina/ReginaThemeSelector;->startActivity(Landroid/content/Intent;)V

    .line 126
    invoke-super/range {p0 .. p5}, Landroid/app/ListActivity;->onListItemClick(Landroid/widget/ListView;Landroid/view/View;IJ)V

    .line 127
    return-void
.end method
